home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Roll.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  3.4 KB  |  142 lines

  1. /*
  2. ** $VER: Roll.ieb 1.1, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 25/1 1997 Stockholm/Sweden
  6. **
  7. ** Roll image.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.  
  41.   Xoff=32 ; Yoff=32
  42.  
  43.   if command ~= '' then parse var command Xoff Yoff
  44.  
  45.   'IE_TO_FRONT'
  46.  
  47.   'FORM "Roll" " OK | Cancel "',
  48.   ' INTEGER,"X displacement",-4096,4096,'Xoff',SLIDER',
  49.   ' INTEGER,"Y displacement",-4096,4096,'Yoff',SLIDER'
  50.  
  51.   parse var result ok Xoff Yoff
  52.   if ok = 0 then return '<ERROR>'
  53.  
  54.   back = Xoff Yoff
  55. return back
  56.  
  57. /* Required "Process_image" procedure  ------------------------------- */
  58.  
  59. process_image:
  60.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  61.   parse var options Xoff Yoff
  62.  
  63.   'OPEN' '"'src_image'"' '24'
  64.   if (RC ~= 0) then do
  65.     'IE_TO_FRONT'
  66.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  67.     return '<ERROR>'
  68.   end
  69.   else LoadImage = result
  70.  
  71.   'PROJECT_INFO' LoadImage 'WIDTH'
  72.   RW=RESULT
  73.   'PROJECT_INFO' LoadImage 'HEIGHT'
  74.   RH=RESULT
  75.  
  76.   do until ((Xoff < RW)&(Xoff >= 0))
  77.     if Xoff >= (RW-1) then Xoff = Xoff - RW
  78.     if Xoff < 0 then Xoff = Xoff + RW
  79.   end
  80.  
  81.   do until ((Yoff < RH)&(Yoff >= 0))
  82.     if Yoff >= (RH-1) then Yoff = Yoff - RH
  83.     if Yoff < 0 then Yoff = Yoff + RH
  84.   end
  85.  
  86.   'MARK' LoadImage 'PRIMARY'
  87.   'MARK' LoadImage 'SECONDARY'
  88.   'COMPOSITE' Xoff Yoff 'MIX 100'
  89.   MasterRoll = RESULT
  90.  
  91.   'MARK' LoadImage 'PRIMARY'
  92.   'MARK' MasterRoll 'SECONDARY'
  93.   'COMPOSITE' Xoff (Yoff-RH) 'MIX 100'
  94.   ToppedRoll = RESULT
  95.   'CLOSE' MasterRoll
  96.  
  97.   'MARK' LoadImage 'PRIMARY'
  98.   'MARK' ToppedRoll 'SECONDARY'
  99.   'COMPOSITE' (Xoff-RW) Yoff 'MIX 100'
  100.   SidedRoll = RESULT
  101.   'CLOSE' ToppedRoll
  102.  
  103.   'MARK' LoadImage 'PRIMARY'
  104.   'MARK' SidedRoll 'SECONDARY'
  105.   'COMPOSITE' (Xoff-RW) (Yoff-RH) 'MIX 100'
  106.   OutputImage = RESULT
  107.   'CLOSE' SidedRoll
  108.   'CLOSE' LoadImage
  109.  
  110.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  111.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  112.   if (RC ~= 0) then do
  113.     'IE_TO_FRONT'
  114.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  115.     return '<ERROR>'
  116.   end
  117.   'CLOSE' OutputImage
  118.  
  119.   back = 'OK'
  120. return back
  121.  
  122. /* Internal procedures  ---------------------------------------------- */
  123.  
  124. /*******************************************************************/
  125. /* This is where control goes when an error code is returned by IE */
  126. /* It puts up a message saying what happened and on which line     */
  127. /*******************************************************************/
  128.  
  129. error:
  130. if RC=5 then do
  131.     IE_TO_FRONT
  132.     LAST_ERROR
  133.     'REQUEST "'||RESULT||'"'
  134. end
  135. else do
  136.     IE_TO_FRONT
  137.     LAST_ERROR
  138.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  139. end
  140.  
  141. return '<ERROR>'
  142.